<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>五指山污水处理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/huazhi/lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/huazhi/css/public.css" media="all">
    <link rel="shortcut icon" href="<%=request.getContextPath()%>/huazhi/images/favicon.ico"/>
    <link rel="stylesheet" href="<%=request.getContextPath()%>/css/logincss/layout.css" media="all">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/css/dtree/dtree.css" media="all">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/css/dtree/font/dtreefont.css" media="all">
</head>
<style>
    /* 底部固定区域 */
    .layui-layout-admin .layui-footer {
        padding: 10px 0;
        text-align: center;
    }

    .layui-layout-admin .layui-footer {
        background-color: #fff;
    }

    .el-input__suffix {
        position: absolute;
        height: 100%;
        right: 5px;
        top: 0;
        text-align: center;
        color: #c0c4cc;
        transition: all .3s;
        pointer-events: none;
    }
    .treeSelect .layui-select-title span {
        line-height: 38px;
    }
    .layui-form-select dl{
        padding: 0;
    }

</style>
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <form class="layui-form" lay-filter="component-form-element" id="form" method="post" >
                <div class="layui-tab layui-tab-brief">
                    <div class="layui-tab-content" style="height: auto">
                        <div class="layui-tab-item layui-show">
                            <div class="layui-form-item">
                                <div class="layui-col-lg6">
                                    <div class="layui-col-xs11">
                                        <label class="layui-form-label">村庄名称</label>
                                        <div class="layui-input-block">
                                            <input id="cun" class="layui-input" name="cun" type="text">
                                            <ul id="demoTree1" class="dtree" data-id="-1"></ul>
                                        </div>
                                    </div>
                                    <div class="layui-col-xs1">
                                        <div class="layui-form-mid layui-word-aux"
                                             style="color: red !important;padding: 10px !important;">*
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
            <div class="layui-form-item layui-layout-admin">
                <div class="layui-footer" style="left: 0;padding: 0px;">
                    <button class="layui-btn"  id="pushButton">确定</button>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="<%=request.getContextPath()%>/huazhi/lib/layui-v2.5.5/layui.all.js"></script>
<script src="<%=request.getContextPath()%>/huazhi/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script>
    layui.use(['form', 'laydate', 'layer','laypage','dtree'], function () {
        var $ = layui.$
            , form = layui.form
            , laydate = layui.laydate
            , layer = layui.layer
            , dtree = layui.dtree
             var cunName='';
        var btnClick = document.getElementById("pushButton")
        dtree.render({
            elem: "#demoTree1",
            url: "<%=request.getContextPath()%>/rest/base/getXzTree",
            dataFormat: "list",  //配置data的风格为list
            dataStyle: "layuiStyle",  //使用layui风格的数据格式
            response: {message: "msg", statusCode: 0},  //修改response中返回数据的定义
            skin: "layuiStyle", // laySimple主题风格
            line: true,  // 显示树线
            height: "full",
            icon: "-1",  // 隐藏二级图标
            ficon: ["1", "-1"]
            // initLevel: 3,
        });

        // 点击节点触发回调
        dtree.on("node('demoTree1')", function (obj) {
            var context = JSON.stringify(obj.param.context)
            context = context.replace(/\"/g, "");
            document.getElementById("cun").value = context
            cunName = context

        });
        //按钮点击
        btnClick.onclick = function (){
            parent.getCheckCun(cunName); //GetValue是父界面的Js 方法
            var index = parent.layer.getFrameIndex(window.name);
            parent.layer.close(index);
        }

    });

</script>
</body>
</html>